<template>
	<view class="fanganpage">
		<view class="pagetitle">
			<view class="iconfont icon-jiejuefangan">
				
			</view>
			用户信息
		</view>
		<view class="infobox">
			<view class="numberline">
				<view class="numberbox">
					
				</view>
				<view class="numberbox">
					时间：{{member.createTime}}
				</view>
			</view>
			 <view class="line">
			 	
			 </view>
			 <view class="info">
			 	<view class="labelbox">
			 		<view class="label">
			 			姓名：
			 		</view>
					<view class="value">
						{{member.yzName||''}}
					</view>
			 	</view>
				<view class="labelbox">
					<view class="label">
						性别：
					</view>
					<view class="value">
						{{member.yzSex||''}}
					</view>
				</view>
				<view class="labelbox">
					<view class="label">
						年龄：
					</view>
					<view class="value">
						{{member.yzAge||''}}
					</view>
				</view>
				<view class="labelbox">
					<view class="label">
						身高(cm)：
					</view>
					<view class="value">
						
					</view>
				</view>
				<view class="labelbox">
					<view class="label">
						科室：
					</view>
					<view class="value">
						{{member.yzDepartment||''}}
					</view>
				</view>
				<view class="labelbox">
					<view class="label">
						会员等级：
					</view>
					<view class="value">
						专病服务
					</view>
				</view>
			 </view>
		</view>
		
		<view class="list">
			<view class="itemlist" v-for="item in list" :key="item.id" @click="lookdetail(item)"> 
				<view class="imgbox">
					<image :src="'https://changban.dianjingkeji.net'+item.yzImg[0]" @click.stop="lookimage(item.yzImg)"></image>
				</view>
				<view class="contentbox">
					<view class="name">
						{{item.yzTitle}}
					</view>
					<view class="time">
						上传时间：{{item.createTime}}
					</view>
					<view class="btn" v-if="item.yzStatus==1||item.yzStatus==2" @click.stop="qushenhe(item)">
						去审核
					</view>
					<view class="btn1" v-if="item.yzStatus==3">
						生成中
					</view>
					
					<view class="btn1" v-if="item.yzStatus==4">
						已下发
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
		import {getMemberMedicalOrdersList} from '../../utils/api.js'
	export default {
		data() {
			return {
				member:{},
				list:[]
			}
		},
		onLoad(e) {
			let p={
				phone:uni.getStorageSync('phone'),
				memberId:e.id
			}
			getMemberMedicalOrdersList(p).then(res=>{
				console.log(res)
			this.member=res.data.data.memberInfo
			//this.list=res.data.data.yzInfo
			const newData = res.data.data.yzInfo.map(item => ({
			  ...item,
			  yzImg:item.yzImg.split(',')
			}));
			console.log(newData,'这是处理过的数据')
			this.list=newData
			})
		},
		methods: {
			
			lookimage(e) {
			  // e 是一个图片路径数组，如 ['/upload/1.jpg', '/upload/2.png']
			  const baseUrl = 'https://changban.dianjingkeji.net/prod-api'; // 注意：用 /prod-api，不是根路径
			  const urls = e.map(path => {
			    // 清理路径前后的空格，确保拼接正确
			    return baseUrl + (path.startsWith('/') ? path : '/' + path);
			  });
			
			  uni.previewImage({
			    urls: urls,
			    longPressActions: {
			      itemList: ['发送给朋友', '保存图片', '收藏'],
			      success: function(data) {
			        console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
			      },
			      fail: function(err) {
			        console.log(err.errMsg);
			      }
			    }
			  });
			},
			lookdetail(e){
				if(e.yzStatus!=4){
			uni.showToast({
				title: '方案生成中',
				icon:'none',
				duration: 2000
			});
				}else{
			
					let id=e.id
					uni.navigateTo({
						url:'/pagesB/yizhudetail/yizhudetail?id='+id
					})	

				}
				
			},
			qushenhe(e){
				let id=e.id
				let mid=e.memberId
			 	 uni.navigateTo({
			 	url:'/pagesB/shenhe/shenhe?id='+id+'&mid='+mid
			 }) 
			},
		}
	}
</script>

<style lang="less" scoped>
 .fanganpage{
	 width: 750rpx;
	 box-sizing: border-box;
	 padding: 40rpx 20rpx;
	 .pagetitle{
		 display: flex;
		 align-items: center;
		 color: #1a4f8a;
		 font-weight: bold;
		 font-size: 34rpx;
		 margin-bottom: 20rpx;
		 .iconfont{
			 margin-right: 20rpx;
			 font-size: 44rpx;
		 }
	 }
	 .infobox{
		 margin: 20rpx 0;
		 width: 100%;
		 background-color: white;
		 box-sizing: border-box;
		 padding: 20rpx;
		 .numberline{
			 display: flex;
			 align-items: center;
			 line-height: 2.2;
			 font-size: 24rpx;
			 font-weight: bold;
			 .numberbox{
				 margin-right: 40rpx;
			 }
		 }
		 .line{
			 width: 100%;
			 border-top: 8rpx solid #1a4f8a;
			 border-bottom: 1rpx solid #1a4f8a;
			 padding: 4rpx 0;
			 margin: 20rpx 0;
		 }
		 .info{
			 width: 100%;
			  display: flex;
			  align-items: flex-start;
			  flex-wrap: wrap;
			  line-height: 2.2;
			  .labelbox{
				  display: flex;
				  width: 33%;
				  font-size: 22rpx;
				  font-weight: bold;
				   align-items: center;
				  .value{
					  font-size: 26rpx;
					  color: #1a4f8a;
				  }
			  }
			  
		 }
	 }
	 .list{
		 width: 100%;
		 box-sizing: border-box;
		 padding: 20rpx;
		 margin-top: 20rpx;
		 .itemlist{
			 width: 100%;
			 display: flex;
			 align-items: center;
			 margin-top: 10rpx;
			 .imgbox{
				 width: 280rpx;
				 height: 200rpx;
				 border-radius: 20rpx;
				 margin-right: 20rpx;
				 image{
					 width: 100%;
					 height: 100%;
					 border-radius: 20rpx;
					 
				 }
			 }
			 .contentbox{
				 flex: 1;
				 line-height: 2.2;
				 .name{
					 font-weight: bold;
				 }
				 .time{
					 font-size: 22rpx;
					 color: gray;
				 }
				 .btn{
					 width: 140rpx;
					 height: 60rpx;
					 border-radius: 10rpx;
					 color: white;
					 text-align: center;
					 line-height: 60rpx;
					 font-weight: bold;
					 font-size: 28rpx;
					 background-color: #1a4f8a;
					 margin-left: 200rpx;
					 margin-top: 10rpx;
				 }
				 .btn1{
				 					 width: 140rpx;
				 					 height: 60rpx;
				 					 border-radius: 10rpx;
				 					 color: white;
				 					 text-align: center;
				 					 line-height: 60rpx;
				 					 font-weight: bold;
				 					 font-size: 28rpx;
				 					 background-color: #cccccc;
				 					 margin-left: 200rpx;
				 					 margin-top: 10rpx;
				 }
			 }
		 }
	 }
 }
</style>
